package com.example.designpattern.test.testProtected.test2;

import java.util.Arrays;

public class Main1 {
    public static void main(String[] args) {
        String s = "I love steam  ,,a;lksd;alksdpojuoiwerujtoiuejrfljskdhfgnkl;jasdhfgpoiawjheropzZzzzzzzzzzzzz;lk;ldsflkfjhlsdhfjjjjjjjjskljhdfsbB";
//        f1();
        int[] ints = get(s);
        System.out.println(Arrays.toString(ints));
        for (int i = 0; i < ints.length; i++) {
            System.out.print((char) (i+97)+":"+ints[i]+"  ");
            System.out.print((char) (i+97)+"[");
            for (int j = 0; j < ints[i]; j++) {
                System.out.print((char) (i+97));
//                System.out.print(j+1);
            }
            System.out.println("]");
        }

        int b=-559;
        System.out.println((byte)b);
    }

    public static void f1() {
        for (char i = 'a'; i <= 'z'; i++) {
            System.out.println("case '" + i + "': " + "arr[" + (i - 97) + "]++; break;");
            System.out.println("case '" + (i + "").toUpperCase() + "': " + "arr[" + (i - 97) + "]++; break;");
        }
    }

    public static int[] get(String s) {
        int[] arr = new int[26];
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case 'a':
                case 'A':
                    arr[0]++;
                    break;
                case 'b':
                case 'B':
                    arr[1]++;
                    break;
                case 'c':
                case 'C':
                    arr[2]++;
                    break;
                case 'd':
                case 'D':
                    arr[3]++;
                    break;
                case 'e':
                case 'E':
                    arr[4]++;
                    break;
                case 'f':
                case 'F':
                    arr[5]++;
                    break;
                case 'g':
                case 'G':
                    arr[6]++;
                    break;
                case 'h':
                case 'H':
                    arr[7]++;
                    break;
                case 'i':
                case 'I':
                    arr[8]++;
                    break;
                case 'j':
                case 'J':
                    arr[9]++;
                    break;
                case 'k':
                case 'K':
                    arr[10]++;
                    break;
                case 'l':
                case 'L':
                    arr[11]++;
                    break;
                case 'm':
                case 'M':
                    arr[12]++;
                    break;
                case 'n':
                case 'N':
                    arr[13]++;
                    break;
                case 'o':
                case 'O':
                    arr[14]++;
                    break;
                case 'p':
                case 'P':
                    arr[15]++;
                    break;
                case 'q':
                case 'Q':
                    arr[16]++;
                    break;
                case 'r':
                case 'R':
                    arr[17]++;
                    break;
                case 's':
                case 'S':
                    arr[18]++;
                    break;
                case 't':
                case 'T':
                    arr[19]++;
                    break;
                case 'u':
                case 'U':
                    arr[20]++;
                    break;
                case 'v':
                case 'V':
                    arr[21]++;
                    break;
                case 'w':
                case 'W':
                    arr[22]++;
                    break;
                case 'x':
                case 'X':
                    arr[23]++;
                    break;
                case 'y':
                case 'Y':
                    arr[24]++;
                    break;
                case 'z':
                case 'Z':
                    arr[25]++;
                    break;
                default:
                    break;
            }
        }
        return arr;
    }
}
